//
//  TOAFHttpUtils.h
//  IMChat
//
//  Created by CLSgGhost on 2021/6/20.
//  Copyright © 2021年 TeamOne. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <RongIMKit/RongIMKit.h>
#import <AFNetworking.h>
#import <CommonCrypto/CommonDigest.h>
#import <SAMKeychain.h>

#import "AppDelegate.h"
#import "UserInfoModel.h"
#import "FriendInfoModel.h"
#import "NewFriendMessageModel.h"
#import "GroupInfoModel.h"

#define AppKey @"bmdehs6pbf59s"
#define AppSecret  @"WS62uFQ9bvZh"

NS_ASSUME_NONNULL_BEGIN

typedef void (^HttpSuccess) (NSString *result);//NSString类型重定义一个block

typedef void (^HttpGetListSuccess) (NSArray *resultList);//NSArray类型重定义一个block

typedef void (^UserModelBlock) (UserInfoModel *userModel);//User类型重定义一个block

typedef void (^GroupInfoModelBlock) (GroupInfoModel *groupModel);//User类型重定义一个block

@interface TOAFHttpUtils : NSObject

@property (nonatomic,copy)HttpSuccess block;

@property (nonatomic,copy)HttpGetListSuccess blockList;

@property (nonatomic,copy)UserModelBlock userModel;

@property (nonatomic,copy)GroupInfoModelBlock groupModel;

// 获取用户token
+ (void)requestRCIMToken:(NSString *)userId
                withName:(NSString *)userName
         withPortraitUri:(NSString *)userPortraitUri
               withBlock:(HttpSuccess)block;

// SHA1加密算法
+ (NSString *)sha1:(NSString *)key;

// 验证用户登陆
+ (void)verifyUserLogin:(NSString *)userId
           withPassword:(NSString *)userPassword
              withBlock:(HttpSuccess)block;

// 用户注册
+ (void)userRegister:(NSString *)userId
            withName:(NSString *)userName
        withPassword:(NSString *)userPassword
           withBlock:(HttpSuccess)block;

// 查找用户好友
+ (void)findUserFriends:(NSString *)userId
              withBlock:(HttpSuccess)block;

// 自己对别人发送好友请求
+ (void)sendAddNewFriendMessage:(RCContactNotificationMessage *)messageModel
                      withBlock:(HttpSuccess)block;

// 根据ID查找用户是否存在
+ (void)findUserIsExist:(NSString *)userId
           withBlock:(HttpSuccess)block;

// 根据ID查找用户信息
+ (void)findUserById:(NSString *)userId
           withBlock:(UserModelBlock)blockUserModel;

// 修改用户信息（昵称、性别）
+ (void)updateUserById:(UserInfoModel *)userInfo;

// 添加好友请求数据信息
+ (void)addNewFriendRequestInfo:(RCContactNotificationMessage *)messageModel;

// 根据ID查找好友请求数据信息
+ (void)findNewFiendRequestInfo:(NSString *)userId;

// 轻服务添加好友关系
+ (void)acceptAddNewFriend:(NSString *)userId
              withFriendId:(NSString *)friendId
                 withBlock:(HttpSuccess)block;

// 轻服务更新好友请求信息的operation
+ (void)updateAcceptRequest:(RCContactNotificationMessage *)messageModel;

// 创建群组
+ (void)createGroup:(NSMutableArray *)userIdList
            groupId:(NSString *)groupId
          withBolck:(HttpSuccess)block;

// 轻服务添加群组信息
+ (void)addGroupInfo:(NSMutableArray *)groupMemberList
               block:(HttpSuccess)block;

// 通过群组ID查找群组信息
+ (void)findGroupInfoById:(NSString *)groupId
                    block:(GroupInfoModelBlock)block;

// 发送群系统消息
+ (void)sendGroupMessage:(NSString *)groupId
                 content:(RCGroupNotificationMessage *)groupMessage;

@end

NS_ASSUME_NONNULL_END
